package org.shareworth.online_life.client;

import org.shareworth.online_life.client.mvc.AppController;
import org.shareworth.online_life.client.mvc.AppEvents;

import com.extjs.gxt.ui.client.mvc.Dispatcher;
import com.extjs.gxt.ui.client.state.CookieProvider;
import com.extjs.gxt.ui.client.state.StateManager;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

public class Online_life implements EntryPoint {

	@Override
	public void onModuleLoad() {

	//	RootPanel.get().add(new MainLayout());
		Dispatcher dispatcher = Dispatcher.get();
		dispatcher.addController(new AppController());
		StateManager.get().setProvider(new CookieProvider(null,null,null,true ));
		Object object = StateManager.get().get("login");
		if(object==null||!(Boolean)object){
			dispatcher.dispatch(AppEvents.Login);
		}else {
			dispatcher.dispatch(AppEvents.Init);
		}
		
		//清空页面原有的HTML代码
		Viewport viewport = new Viewport();
		RootPanel.get().add(viewport);
		
	}

}
